"use client"; import { CashbackTypes } from "@/api/cashback"; import { server } from "@/utils/client"; import { timeFormat } from "@/utils/methods"; import { Toast } from "antd-mobile"; import { useAnimate } from "framer-motion"; import { useTranslations } from "next-intl"; import styles from "./style.module.scss"; interface Props { local: string; cashbackInfo: CashbackTypes; } const Extract = (props: Props) => { const { local, cashbackInfo } = props; const [scope, animate] = useAnimate(); const t = useTranslations(); const getCashbackGiveApi = () => { if (cashbackInfo.status !== "pending") { animate( scope.current, { color: ["#000", "#ffaa30", "#000"] }, { duration: 0.6, repeat: 2, repeatType: "loop", } ); return; } if (cashbackInfo.amount === 0) { return; } return server .post({ url: "/v1/api/front/activity_cash_give", }) .then((res) => { if (res.code === 200) Toast.show(t(`code.200`)); }) .catch((error) => { Toast.show(t(`code.${error.data.code}`)); }); }; return ( <>
{t("cashback.receiveButton")}
); }; export default Extract;